Skip to content

Stop overwriting all inbox items with onboarding message#2740

Merged
Crabcyborg merged 3 commits into
masterfrom
stop_overwriting_all_inbox_items_with_onboarding_message
Jan 8, 2026
Merged

Stop overwriting all inbox items with onboarding message#2740
Crabcyborg merged 3 commits into
masterfrom
stop_overwriting_all_inbox_items_with_onboarding_message

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

I'm doing some code analysis and it found that $inbox_messages is never used.

But it should be if this is used on the option_frm_inbox filter, as it overwrites all other messages the way it was written.

@coderabbitai

coderabbitai Bot commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@Crabcyborg has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a41b3e7 and 3d44311.

📒 Files selected for processing (1)
  • classes/controllers/FrmOnboardingWizardController.php

Walkthrough

The add_wizard_to_floating_links method in FrmOnboardingWizardController.php was refactored to mutate the input $inbox_messages array directly rather than creating and returning a new array. The method signature remains unchanged; only the internal implementation and return behavior were modified.

Changes

Cohort / File(s) Summary
Onboarding Wizard Array Mutation
classes/controllers/FrmOnboardingWizardController.php
Modified add_wizard_to_floating_links method to mutate the input $inbox_messages array by assigning the onboarding_wizard entry directly, rather than constructing and returning a new array

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

run analysis, run tests

Suggested reviewers

  • shervElmi
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main change: modifying the function to stop overwriting all inbox items by properly using the $inbox_messages parameter.
Description check ✅ Passed The description clearly explains the issue found through code analysis and relates directly to the changeset's purpose of fixing how $inbox_messages is handled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @classes/controllers/FrmOnboardingWizardController.php:
- Line 471: Ensure $inbox_messages is an array before assigning to
$inbox_messages['onboarding_wizard']; validate the parameter returned by the
option/filter (e.g., option_frm_inbox) and coerce or initialize it to an array
if it's null/false/non-array (for example by checking is_array($inbox_messages)
and setting $inbox_messages = array() when not); update the code around the
$inbox_messages['onboarding_wizard'] assignment in FrmOnboardingWizardController
to perform this guard so no PHP warning/fatal occurs when non-array values are
returned.
🧹 Nitpick comments (1)
classes/controllers/FrmOnboardingWizardController.php (1)

469-469: Consider inlining the $message variable.

The $message variable is only used twice in close proximity. You could inline it directly in the array definition to reduce variable declarations.

♻️ Proposed refactor
 public static function add_wizard_to_floating_links( $inbox_messages ) {
-	$message = __( 'Welcome to Formidable Forms! Click here to run the Onboarding Wizard and it will guide you through the basic settings and get you started in 2 minutes.', 'formidable' );
+	if ( ! is_array( $inbox_messages ) ) {
+		$inbox_messages = array();
+	}

+	$message = __( 'Welcome to Formidable Forms! Click here to run the Onboarding Wizard and it will guide you through the basic settings and get you started in 2 minutes.', 'formidable' );
+
 	$inbox_messages['onboarding_wizard'] = array(
 		'subject' => esc_html__( 'Begin With Ease!', 'formidable' ),
 		'message' => esc_html( $message ),

Note: Keep the variable as-is if you prefer the clarity, especially since $message is used in both 'message' and 'slidein' keys.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 541d06d and a41b3e7.

📒 Files selected for processing (1)
  • classes/controllers/FrmOnboardingWizardController.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Cypress
  • GitHub Check: PHP 8 tests in WP 6.9
  • GitHub Check: PHP 7.4 tests in WP 6.9
  • GitHub Check: PHP 7.4 tests in WP 6.9
  • GitHub Check: PHP 8 tests in WP 6.9
  • GitHub Check: Cypress
🔇 Additional comments (1)
classes/controllers/FrmOnboardingWizardController.php (1)

468-481: Fix correctly preserves existing inbox messages.

The refactored implementation now properly adds the onboarding wizard message to the existing $inbox_messages array instead of overwriting all messages. This resolves the bug described in the PR objectives.

Comment thread classes/controllers/FrmOnboardingWizardController.php

@shervElmi shervElmi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me! 🚀

Thanks @Crabcyborg.

@Crabcyborg

Copy link
Copy Markdown
Contributor Author

Thanks Sherv!

@Crabcyborg
Crabcyborg merged commit 73f68f6 into master Jan 8, 2026
16 checks passed
@Crabcyborg
Crabcyborg deleted the stop_overwriting_all_inbox_items_with_onboarding_message branch January 8, 2026 17:35
stephywells pushed a commit that referenced this pull request Apr 4, 2026
…tems_with_onboarding_message

Stop overwriting all inbox items with onboarding message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants